package cn.edu.scau.cmi.huangxiaodong.consistentComposite;

import java.util.ArrayList;


public class Person implements Organization{
	private String name=null;
	  public void setName(String name) {
		this. name=name;
	  }
	private ArrayList<Organization> parts= new ArrayList<>();
	
     public String getName(){
		 return name;
	 }
   public void addOrg(Organization org){
	    if(org!=null) {
	    	 parts.add(org);
	    }
 }
   public void removeOrg(Organization org) {
  	 if(parts.contains(org)) {
  			parts.remove(org);
  	 }
   }
   public Organization getOrg(int index) {
  	 if(index<parts.size()) {
  		 return parts.get(index);
  	 }else {
  		 return null;
  	 }
   }
}
